package br.mg.bhe.ftpobre.fs.compare;

import java.util.Comparator;

import br.mg.bhe.ftpobre.fs.LocalFile;

/**
 * Files and Folders.
 * 
 * @author Aureliano
 */
public class CompareLocalFilesByLogicalType implements Comparator<LocalFile> {

	@Override
	public int compare(LocalFile file1, LocalFile file2) {
		if (file1.isDirectory() && file2.isDirectory()) {
			return file1.getName().compareTo(file2.getName());
		}
		
		return (file1.isDirectory()) ? -1 : 1;
	}
}